package tests;

import junit.framework.TestCase;
import lz77.util.LoopArray;

public class LoopArrayTest extends TestCase {
	
	LoopArray arr;
	
	protected void setUp() throws Exception {
		super.setUp();
		arr = new LoopArray((char) 26);
		for (byte c = 'A'; c<='Z'; c++){
			arr.push(c);
		}
		arr.toString();
	}

	public void testGet() {
		assertEquals(arr.get(0),'A');
		assertEquals(arr.get(25),'Z');
	}
	
	public void testGetSlice() {
		arr.push((byte)'B');
		byte[] bytes = arr.getSlice(23, 3);
		assertEquals(bytes[0],'Y');
		assertEquals(bytes[1],'Z');
		assertEquals(bytes[2],'B');
	}
	
	public void testPush(){
		arr.push((byte) 'E');
		assertEquals(arr.get(25),'E');
		assertEquals(arr.get(0),'B');
	}

}
